package com.blstudio.ghgallery;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.GridView;

import com.blstudio.R;
import com.blstudio.ghgallery.common.GHGalleryConstant;
import com.blstudio.ghgallery.common.ImageAdapter;

public class GHGalleryList extends Activity {

	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.image_list);

		GridView gv = (GridView)findViewById(R.id.ImgGridView);

		final ImageAdapter ia = new ImageAdapter(GHGalleryConstant.getInstance().getGalleryConstant(), this.getApplicationContext());

		gv.setAdapter(ia);
		gv.setOnItemClickListener(new OnItemClickListener() {

			public void onItemClick(AdapterView<?> parent, View v, int position, long id) {
				Intent intent = new Intent(GHGalleryList.this, GHGalleryDetail.class);
				intent.putExtra("position", position);

				startActivity(intent);
			}
		});
	}
}